package com.thwj.project.pay;

import cn.hutool.core.util.RandomUtil;
import com.thwj.common.utils.WzDateUtil;
import com.thwj.project.pay.enums.OrderSourceTypeEnum;

import java.util.Date;

public class OrderNumberUtil {
    // 订单id生成规则  订单类型 + yyyyMMddHHmmssSSS + 随机3位
    public static String getOrderNumberBySourceType(OrderSourceTypeEnum typeEnum){
        return typeEnum.getOrderPrefix() + getOrderNumber();
    }

    public static String getOrderNumber(){
        return WzDateUtil.date2String(new Date(),WzDateUtil.TIME_FORMAT_J) +
                RandomUtil.randomNumbers(4);
    }

}
